package io.kiki.stack.http.feign.jaxb;

import java.util.Objects;

/**
 * Encapsulate data used to build the cache key of JAXBContext when created using class mode.
 */
final class JAXBContextClassCacheKey implements JAXBContextCacheKey {

    private final Class<?> clazz;

    JAXBContextClassCacheKey(Class<?> clazz) {
        this.clazz = clazz;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        JAXBContextClassCacheKey that = (JAXBContextClassCacheKey) o;
        return clazz.equals(that.clazz);
    }

    @Override
    public int hashCode() {
        return Objects.hash(clazz);
    }
}
